package com.yequan.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Run {

    public static void main(String[] args) {
        MyThreadFactory myThreadFactory = new MyThreadFactory();
        ExecutorService executorService = Executors.newCachedThreadPool(myThreadFactory);
        ExecutorService fixedThreadPool = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 10; i++) {
            fixedThreadPool.execute(new Runnable() {
                @Override
                public void run() {
//                    System.out.println("======>" + System.currentTimeMillis() + "  " + Thread.currentThread().getName());
                    if (Thread.currentThread().getId() == 11) {
                        Thread.currentThread().interrupt();
                    } else {
                        System.out.println("======>" + System.currentTimeMillis() + "  " + Thread.currentThread().getId());
                    }
                }
            });
        }
    }

}
